package com.tcl.scan;

import com.tcl.controller.MainApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@ConditionalOnBean(User2.class)
public class MyConfig {

    @Bean
    public User2 user2(){
        return new User2();
    }

    @Bean
    public User user(){
        User user = new User();
        user.setPet(tom());
        return user;
    }

    @Bean
    public Pet tom(){
        return new Pet();
    }


}
